<?php

namespace App\Core\Event;

use App\Events\Message\CommonMessage;
use Illuminate\Contracts\Queue\ShouldQueue;

class JobMessage extends CommonMessage
{

    /**
     * @var ShouldQueue
     */
    private $job;

    /**
     * @return ShouldQueue
     */
    public function getJob(): ShouldQueue
    {
        return $this->job;
    }

    /**
     * @param ShouldQueue $job
     */
    public function setJob(ShouldQueue $job): void
    {
        $this->job = $job;
    }

    public function jsonSerialize()
    {
        return [
            'action' => $this->getAction(),
            'retry' => $this->getRetry(),
            'job' => serialize($this->getJob())
        ];
    }


}